home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / TERMINAL / TERMINAL.DOC < prev   
Text File  |  1990-12-19  |  33KB  |  733 lines

  1. ===========================================================================
  2. "Terminal"                 A Serial Communication Program For The Macintosh
  3. ===========================================================================
  4.  
  5.                         Version 2.0 (20-Nov-1990)
  6.  
  7.  
  8. ___________________________________________________________________________
  9. INTRODUCTION
  10.  
  11.  
  12. "Terminal" is a serial communication program for the Macintosh computer.
  13. Features are:
  14.  
  15. * Fast display. No characters are lost for up to 4800 Baud on a Mac Plus,
  16. or up to 9600 Baud on a Mac IIcx in 1-bit color mode, with text capture to
  17. disk enabled. (For most commercial programs this only holds for short term
  18. until the serial input buffer is full.)
  19.  
  20. * Capture buffer, so that the last 32768 (default, can be configured, upper
  21. limit is 32768 lines) characters are always available in the scrolling
  22. terminal window. The buffer can be saved as TEXT file to disk or appended
  23. to an existing file. Very fast scrolling to move around in the buffer.
  24.  
  25. * Text capture to disk, so that everything received or transmitted is saved
  26. automatically to a TEXT file on disk. Can also be appended to an existing
  27. file.
  28.  
  29. * Send TEXT files from disk, from up to 10 different macro buffers or from
  30. the clipboard. Wait for prompt string before sending line, delay after each
  31. line, delay after each character.
  32.  
  33. * XON/XOFF, CTS, DTR and CTS/DTR handshake. Hardware handshake is useful
  34. for high speed modems or terminal node controllers.
  35.  
  36. * Binary file transfer using X-Modem protocol (checksum, CRC or 1K
  37. options), Y-Modem (i.e. XModem batch), Z-Modem or CompuServe QuickB
  38. protocol (up- and download). Automatic recognition of MacBinary (I and II)
  39. file format.
  40.  
  41. * Built-in C interpreter with a rich set of intrinsic functions to execute
  42. scripts from TEXT files. Scripts can be as simple as modem setup, dial or
  43. auto-logon, but can also be used to program a complete BBS.
  44.  
  45. * Very compact program. Only about 90K on disk and can run in a 160K
  46. partition under MultiFinder.
  47.  
  48. * Complete non-modal user driven program (even during file transfers). Runs
  49. in the background under MultiFinder (even if "Set Aside" under
  50. MultiFinder). Several copies of the program may be run at the same time,
  51. under MultiFinder, each one on a different serial port.
  52.  
  53. * Recognizes and uses all serial devices that are correctly registered with
  54. the Communications Toolbox.
  55.  
  56. * The program is free.
  57.  
  58. * Source code is free (can be compiled with THINK C 4.02 or MPW 3.2 C).
  59.  
  60.  
  61. ___________________________________________________________________________
  62. CONFIGURATION
  63.  
  64.  
  65. "Terminal" was developed (in THINK C 4.02 and MPW 3.2) and tested on a
  66. Macintosh Plus and on a Macintosh IIcx with System 6.05 under MultiFinder
  67. 6.1b9 (The MultiFinder with the "Set Aside" option). The program is
  68. MultiFinder aware and can work in the background even if "Set Aside". HFS
  69. (hierarchical file system) and 128K ROMs (or newer) are required, so
  70. "Terminal" will not run on "old" Macs and needs at least a Mac Plus.
  71. "Terminal" was tested and runs fine with System 7.0b1 (October release).
  72.  
  73. I made no special attempts to stay compatible with old system versions, nor
  74. was the program tested on old system versions. But I made every effort to
  75. follow Apple's rules in order to stay compatible with future systems and
  76. hardware. (The only exception is the script function getdcd() where I had
  77. to read the status register of the SCC directly.)
  78.  
  79. "Terminal" will recognize all serial devices that are correctly registered
  80. with the Communications Toolbox, but otherwise does not use or require the
  81. Communications Toolbox.
  82.  
  83.  
  84. ___________________________________________________________________________
  85. FILES AND FOLDERS
  86.  
  87.  
  88. * "Terminal" the application, can be anywhere on your disk.
  89.  
  90. * "Terminal Folder" is a folder that should be created in the same folder
  91. as the "Terminal" application. All scripts (a script is a TEXT file with a
  92. suffix of ".s") in this folder will be included in the "Scripts" menu for
  93. easy execution. If this folder does not exist, all scripts in the same
  94. folder as the "Terminal" application will be included in the "Scripts"
  95. menu. This script folder, or the application folder if the script folder
  96. does not exist, is also used as the default folder for loading macro files
  97. by the script language (function "macrol"). If there is a file named
  98. "Macros.m" in this folder it will be loaded as the macro set at startup.
  99.  
  100. * "Terminal Settings" is created by "Terminal" in the "Terminal Folder", or
  101. in the application folder if "Terminal Folder" does not exist, to store the
  102. options selected. If this file is not found when "Terminal" starts up,
  103. default options will be used. In this file are also stored the current
  104. positions of the terminal and the progress window, so that they will be
  105. positioned again at the same location when the application is restarted.
  106. (The settings file is not stored in the System folder so that multiple
  107. copies of "Terminal" can run on the same machine, under MultiFinder, each
  108. one on a different port.)
  109.  
  110. * The "Terminal options" menu can be used to select a start-up script, that
  111. will be automatically executed when the application is started. This script
  112. can be anywhere on the disk. By default there is no start-up script. A
  113. script can force "Terminal" to quit when the script has finished. Using
  114. this feature and a startup script you can use Terminal to make file
  115. transfers from inside HyperCard stacks (you can even make HyperCard modify
  116. the startup script before running Terminal), or from other programmable
  117. applications that support launching other applications.
  118.  
  119. * Scripts can be started from the Finder by double-clicking (opening) if
  120. their creator was changed from the creator of the TEXT editor that created
  121. them to Terminal's creator. See the "Kiss script file" command in the
  122. "File" menu description.
  123.  
  124. * For use with Y-Modem batch, Z-Modem and CompuServe QuickB file transfers
  125. a folder must exist on the disk where all downloads and uploads using these
  126. protocols will look for and store files. This folder can be selected by
  127. using the "File transfer options" menu option. The default folder is the
  128. same as the folder containing the "Terminal" application. This folder is
  129. also the default folder used by script file commands.
  130.  
  131.  
  132. Note: If you had a previous version of "Terminal" on your disk please
  133. rebuild the Desktop file (hold down the option and the command key when
  134. booting) so that the Finder recognizes the new icons and file types.
  135.  
  136.  
  137. ___________________________________________________________________________
  138. THE TERMINAL WINDOW
  139.  
  140.  
  141. There is a fixed size window with 24 lines and 81 columns (default values,
  142. can be configured). The window can be moved anywhere on the screen. A
  143. vertical scroll bar allows fast moving around in the last 32768 (default
  144. value, can be configured) characters received. If a new character is
  145. received the text automatically scrolls to the end. Everything received is
  146. displayed in the terminal window, even if the window is not the frontmost
  147. or if the application was switched out under MultiFinder.
  148.  
  149. Note: "Terminal" tries to scroll the window as fast as possible. If the
  150. window is partially covered by other windows, the scrolling slows down some
  151. what. If during scrolling you move windows around, the terminal window
  152. might not update correctly. In this case simply click inside the terminal
  153. window to force "Terminal" to redraw the whole window.
  154.  
  155. The name of the window will be "Terminal" if no script is executing,
  156. otherwise the window name will be the same as the name of the script file.
  157. To cancel a running script select it again under the corresponding menu
  158. item.
  159.  
  160. If the terminal window is frontmost everything typed on the keyboard is
  161. transmitted. If the local-echo option is selected it is also echoed to the
  162. window. To send control characters the "Option" key (in this case all
  163. characters that are only available by using the "Option" key are no longer
  164. available) or the "Command" key (in this case the "Command" key cannot be
  165. used to select menu commands) can replace the "Control" key, if your
  166. keyboard doesn't have one.
  167.  
  168. After file transfers a statistics message is displayed in the top area of
  169. the window showing how much bytes were transferred in how much time. This
  170. area is also used to display error messages. If a message is displayed a
  171. button appears to the left of it. Clicking this button will erase the
  172. message and the button. Note that such a message is not a modal dialog but
  173. will stay as long as there is no new message or until it is cleared.
  174. Meanwhile the program continues its normal operation.
  175.  
  176. During file transfers a progress window (this is a non-modal window, not a
  177. modal dialog box, and can be moved around or deselected, and all menu
  178. commands are still available while this window is up) is displayed. This
  179. progress window shows the progress of the file transfer and has a "Cancel"
  180. button. By clicking in this "Cancel" button the file transfer can be
  181. aborted. The file transfer can also be canceled by selecting the
  182. corresponding menu item. If the progress window gets lost beneath other
  183. windows, use the "Edit" menu item "Show progress window".
  184.  
  185. Characters received in terminal mode are filtered using the following
  186. criteria (this is what I consider basic TTY emulation):
  187.  
  188. * All bytes received will get their most significant bit stripped to make 7
  189. bit ASCII characters.
  190.  
  191. * A "CR" character (carriage return, ASCII 13) will move the cursor to the
  192. first position in the next line.
  193.  
  194. * A "Backspace" character will erase the last character received and move
  195. the cursor one position to the left, but will never move to the previous
  196. line. The code to be recognized as "Backspace" can be chosen (see "Options
  197. menu"). If TEXT file capture is on, all characters are saved as received in
  198. the file including the "Backspace" characters.
  199.  
  200. * A "TAB" character (ASCII 9) will be accepted (and saved if TEXT file
  201. capture is on) but displayed as a space character.
  202.  
  203. * Five consecutive "CAN" (control-X, ASCII 24) are recognized as a signal
  204. to abort text file sends, X/Y-Modem or ZModem file transfers.
  205.  
  206. * A "BEL" (control-G, ASCII 7) is recognized and if this feature is enabled
  207. via the "Other options..." menu item, the Macintosh will beep. The "BEL"
  208. character is not saved to the terminal buffer or capture file.
  209.  
  210. * All other control characters are ignored and only characters with ASCII
  211. codes higher then 32 and lower than 126 are accepted (printable
  212. characters).
  213.  
  214. * If lines longer than 81 (depends on the configured window width)
  215. characters are received a "CR" will be inserted automatically after every
  216. 81 characters, and this "CR" will also be saved to disk if TEXT capture is
  217. on.
  218.  
  219.  
  220. ___________________________________________________________________________
  221. THE "FILE" MENU
  222.  
  223.  
  224. SAVE CAPTURE BUFFER
  225.  
  226. A standard file dialog is presented (if the capture buffer is not empty)
  227. allowing to save the contents of the capture buffer to disk as a TEXT file.
  228. The TEXT file creator can be changed using the "Text capture option" item
  229. in the "OPTIONS" menu. If a modifier key (shift, command or option) is
  230. pressed while selecting the menu option the capture buffer gets appended to
  231. the end of an existing TEXT file.
  232.  
  233.  
  234. TEXT CAPTURE
  235.  
  236. A standard file dialog is presented allowing to create the TEXT file where
  237. all further input or output will be saved. The TEXT file creator can be
  238. changed using the "Text capture option" item in the "OPTIONS" menu. The
  239. menu text will change to outlined and expanded, so that when selected again
  240. the capture file will be closed. The file is also automatically closed when
  241. quitting the program. If a modifier key (shift, command or option) is
  242. pressed while selecting the menu option the capture buffer gets appended to
  243. the end of an existing TEXT file.
  244.  
  245.  
  246. TEXT SEND
  247.  
  248. A standard file dialog is presented to select a TEXT file. The file
  249. contents is sent using the options that can be selected in the "TEXT file
  250. transfer options..." item of the "Options" menu. The menu text will change
  251. to outlined and expanded, so that when selected again the transmission will
  252. be canceled. If five control-X characters are received the transmission is
  253. also canceled.
  254.  
  255.  
  256. FILE RECEIVE
  257.  
  258. If X/Y-Modem is enabled and if Y-Modem batch is active, or if Z-Modem is
  259. enabled, the file transfer starts immediately. During such a session more
  260. than one file my be received. All files received are stored in the folder
  261. selected by the "Binary File Transfer Options" dialog. If MacBinary file
  262. format is enabled, the file name used will be the name from the MacBinary
  263. header if this name does not yet exist, otherwise the name from the Y-Modem
  264. header (block 0) or the Z-Modem file information block will be used, and if
  265. a file with this name exists it is deleted first. If MacBinary is disabled
  266. the file name from the Y-Modem header (block 0), or the Z-Modem file
  267. information block, is used, and if a file with this name exists it is
  268. deleted first.
  269.  
  270. Note: Z-Modem creates a temporary file while receiving. This file is not
  271. deleted when the Z-Modem transfer is aborted. Instead when the Z-Modem
  272. receive is resumed later on, it will continue were it stopped before. This
  273. partial Z-Modem file has a special file type and a distinct icon. Only when
  274. the receive is complete, will the file type changed to what it should be.
  275.  
  276. If X/Y-Modem without the batch option (i.e. X-Modem) is chosen a standard
  277. file dialog is presented to create a file to be used for binary file
  278. receive using X-Modem protocol. The X-Modem protocol file receive session
  279. is started. If MacBinary file format is enabled, the file name used will be
  280. the name from the MacBinary header if this name does not yet exist,
  281. otherwise the first chosen name will be used.
  282.  
  283. Note: For CompuServe QuickB protocol file transfers there is no need for
  284. this menu option as the transfers will be initiated by the host and the
  285. host will prompt you for the file name on your computer. For ZModem receive
  286. there is an option (that can be set in the Z-Modem options dialog) to
  287. automatically start the receive, so the FILE RECEIVE menu command need not
  288. be used.
  289.  
  290.  
  291. FILE TRANSMIT
  292.  
  293. A standard file dialog is presented to select the binary file to transmit
  294. using X/Y-Modem or Z-Modem protocol. If the MacBinary file format is
  295. enabled the file is sent in MacBinary II format. In Y-Modem batch, or
  296. Z-Modem, only one file can be send in a session.
  297.  
  298. Note: For CompuServe QuickB protocol file transfers there is no need for
  299. this menu option as the transfers will be initiated by the host and the
  300. host will prompt you for the file name on your computer.
  301.  
  302.  
  303. MAKE MACBINARY FILE
  304.  
  305. Use this utility option to create a MacBinary II file from any other file
  306. on your disk. The MacBinary file gets a special file type and a distinct
  307. icon. Normally this operation need not to be used, because the FILE
  308. TRANSMIT menu command will create the MacBinary II file on the fly while
  309. transmitting.
  310.  
  311.  
  312. EXTRACT FROM MACBINARY FILE
  313.  
  314. Use this utility option to extract a file from a MacBinary I or MacBinary
  315. II file on your disk. This is useful if you have forgotten to enable
  316. automatic MacBinary recognition and you have already downloaded a file.
  317.  
  318.  
  319. KISS SCRIPT FILE
  320.  
  321. Use this utility option to change the creator of TEXT files so that the
  322. "Finder" recognizes them as "Terminal" documents. In this way you can
  323. double-click the script file and it will automatically be executed by
  324. "Terminal". Only TEXT files with a file name ending in ".s" can be changed.
  325. To change back the creator of the TEXT file to the creator of the text
  326. editor application, hold down the option key while selecting the KISS
  327. SCRIPT FILE menu command. The creator of the TEXT file will be set to the
  328. TEXT file creator you have set in the OTHER OPTIONS dialog. When you now
  329. double-click the script file, the text editor will open it.
  330.  
  331.  
  332. QUIT
  333.  
  334. To quit and return to the "Finder" use this option or click in the close
  335. box of the terminal window.
  336.  
  337.  
  338. ___________________________________________________________________________
  339. THE "EDIT" MENU
  340.  
  341.  
  342. The first five items are there for desk accessories. Only the following is
  343. used:
  344.  
  345.  
  346. PASTE
  347.  
  348. The text in the clipboard is sent using the options that can be selected in
  349. the "TEXT file transfer options..." item of the "Options" menu. The menu
  350. text will change to outlined and expanded, so that when selected again the
  351. transmission will be canceled. If five control-X characters are received
  352. the transmission is also canceled.
  353.  
  354.  
  355. CLEAR CAPTURE BUFFER
  356.  
  357. This will clear the capture buffer and the terminal window.
  358.  
  359.  
  360. SHOW PROGRESS WINDOW
  361.  
  362. This selects the progress window and brings it to the front. Useful if the
  363. progress window gets covered by other windows.
  364.  
  365.  
  366. DEBLOCK SEND
  367.  
  368. This kills any outstanding serial write request. It might be useful if the
  369. program has received an XOFF, but never got the XON.
  370.  
  371.  
  372. NEGATE DTR
  373.  
  374. This negates the DTR output (output handshake signal).
  375.  
  376.  
  377. ASSERT DTR
  378.  
  379. This asserts the DTR output (output handshake signal).
  380.  
  381.  
  382. CHECK CTS
  383.  
  384. This displays the current status of the CTS input (input handshake signal)
  385. in the status message window.
  386.  
  387.  
  388. ___________________________________________________________________________
  389. THE "OPTIONS" MENU
  390.  
  391.  
  392. The options selected in the following dialogs are saved in a file, so that
  393. they are again available when the program is started at a later time (the
  394. file name is "Terminal Settings"). If no options file is found when the
  395. program is started, default values will be used.
  396.  
  397.  
  398. COMMUNICATION
  399.  
  400. * Port: None, "Modem", "Printer" or any other serial port available.
  401. * Baud rate: 300 to 56700 Baud.
  402. * Data bits: 7 or 8.
  403. * Stop bits: 1 or 2.
  404. * Parity: even, odd or none.
  405. * Handshake: XON/XOFF, CTS only, DTR only, CTS and DTR.
  406.  
  407. * Don't drop DTR when quitting: useful if you don't want the modem to
  408. hang-up when you quit the program.
  409.  
  410. Note: During X/Y-Modem or QuickB binary file transfers the data bits are
  411. set to 8 bits. When the transfer is finished the original value is
  412. restored. Z-Modem automatically will escape all characters that use the
  413. high order bit if 7 data bits are used thus enabling binary file transfers
  414. over non-transparent links.
  415.  
  416.  
  417. TEXT FILE SEND
  418.  
  419. * Wait for prompt before sending next line: If this option is checked the
  420. program will wait for the prompt string (this can be more than one
  421. character) before sending the next line while sending TEXT files.
  422.  
  423. * Delay after each line sent: If this option is checked the program waits
  424. for the specified number of ticks (1/60 second) before sending the next
  425. line while sending TEXT files.
  426.  
  427. * Delay after each character sent: If this option is checked the program
  428. waits the specified number of ticks (1/60 second) before sending the next
  429. character while sending TEXT files.
  430.  
  431. Note: the TEXT file send parameters are also used when sending macros or
  432. pasting text from the clipboard.
  433.  
  434.  
  435. TERMINAL
  436.  
  437. * Echo: local (display keyboard characters), remote (retransmit received
  438. characters).
  439.  
  440. * Display and capture: if checked the capture window and buffer are active,
  441. else nothing is displayed nor captured.
  442.  
  443. * AutoLF: If this option is checked a linefeed character will be send after
  444. each carriage return character.
  445.  
  446. * Start-up script: Any script can be selected to be executed automatically
  447. when the "Terminal" application is started.
  448.  
  449.  
  450. OTHER
  451.  
  452. * Text capture file creator: file creator for TEXT files used for saving
  453. the capture buffer or by the "Text file capture" option. So if you double-
  454. click on these files your favorite text editor program is automatically
  455. called. If you un-kiss (see FILE MENU) script files they will get this
  456. creator.
  457.  
  458. * File type and creator for non-MacBinary files: if automatic MacBinary
  459. file format recognition is not enabled, or if the file received is not a
  460. valid MacBinary file, this type (default is 'TEXT') and creator are used
  461. for the new file.
  462.  
  463. * Code for "backspace" key: ASCII code send by pressing the "Backspace"
  464. key, and also the ASCII code recognized as "Backspace" code while
  465. receiving.
  466.  
  467. * Code for "`" key: ASCII code send by pressing the "`" key. This can be
  468. used to make an "ESC" key (ASCII 27) on keyboards that don't have an "ESC"
  469. key.
  470.  
  471. * Control-G beeps: if checked any "BEL" (control-G, ASCII 7) character
  472. received will beep.
  473.  
  474. * Control key: the keyboard modifier key to be used for sending control
  475. characters (e.g. cntl-C). On keyboards lacking a "control" key, use either
  476. the "option" key (in this case you cannot send the characters that normally
  477. are only available by using the "option" key) or the "command" key (in this
  478. case you cannot execute menu commands by key equivalent).
  479.  
  480.  
  481. BINARY FILE TRANSFER
  482.  
  483. * MacBinary: use and recognize MacBinary file format in file transfers
  484. (Note that TEXT files are never sent as MacBinary).
  485.  
  486. * CIS-B: recognize and use CompuServe QuickB protocol for file transfers.
  487. If you don't use QuickB uncheck this option. This makes things faster and
  488. eliminates any false triggering into file transfer mode on noisy lines.
  489.  
  490. * X/Y-MODEM: use X-Modem or Y-Modem file transfers when using the
  491. "Receive..." or "Transmit..." commands from the FILE menu. Options can be
  492. set in the "XY-Modem Options..." dialog.
  493.  
  494. * Z-MODEM:  use Z-Modem file transfers when using the
  495. "Receive..." or "Transmit..." commands from the FILE menu. Options can be
  496. set in the "Z-Modem Options..." dialog.
  497.  
  498. * Auto-receive: when this is checked, Z-Modem receive will start
  499. automatically as soon as a the other side has started transmitting. If you
  500. rarely make Z-Modem file transfers, don't check this. This makes things
  501. faster. The likelihood of false triggering is small, but nevertheless
  502. exists.
  503.  
  504. * Path for up- and downloads: folder name used for CIS-B up- and downloads
  505. (because the host will only prompt for the file name on your computer but
  506. not the path name), for Y-Modem batch or Z-Modem file downloads (where only
  507. the file name is in the header block).
  508.  
  509.  
  510. XY-MODEM OPTIONS
  511.  
  512. * CRC        If not checked "classic" X-Modem with simple checksum and 128
  513.              Byte blocks will be used. The "1K" options are disabled.
  514.              If checked CRC error checking will be used and the "1K"
  515.              options are enabled.
  516. * 1K off     128 Byte blocks are used.
  517.      aut     128 or 1024 Byte blocks are used automatically and where
  518.              appropriate. During the initial handshaking phase the single
  519.              character "C" is used. This is the "official" way of doing it.
  520.      CK      1024 Byte blocks are used if during the initial handshaking
  521.              phase the two character sequence "CK" is used (this is used by
  522.              Red Ryder 10.3 and perhaps others).
  523. * batch off  No batch protocol is used, i.e. this is X-Modem.
  524.         Y    "Official" Y-Modem batch protocol is used.
  525.         RR   A variant of the Y-Modem batch protocol is used where there is
  526.              no new handshaking phase after the header block (block 0) has
  527.              been sent (this is used by Red Ryder 10.3 and perhaps others).
  528. * timeout    Select the value 5, 10, 15 or 20 seconds.
  529.  
  530.  
  531. Z-MODEM OPTIONS
  532.  
  533. The first three options are used for receive and transmit.
  534.  
  535. * Escape control characters: if this is checked all control characters are
  536. escaped (including all characters who have their high order bit set). This
  537. slows down Z-Modem but must be used on non-transparent links. In any case,
  538. if using 7 data bits, Z-Modem will ignore this setting and escape all
  539. control characters.
  540.  
  541. * Timeout (seconds): should be set at 10 seconds.
  542.  
  543. * Maximal retries: should be set at 10.
  544.  
  545. The following option is only for Z-Modem receive.
  546.  
  547. * Receive buffer size (bytes): can be set to 0 or a value between 128 and
  548. 32768. If set to 0 the receiver signals to the transmitter that it is able
  549. to receive and save data as fast as it is coming in. Otherwise the sender
  550. will make sure to never have more than this number of non-acknowledged
  551. bytes and waits while the receiver will save the data.
  552.  
  553. The following options are only used for Z-Modem transmit.
  554.  
  555. * Transmit sub-packet length (bytes): can be set to 256 for speeds up to
  556. 1200 Baud, 512 for speeds between 1200 and 2400 Baud, and to 1024 (maximum)
  557. for higher speeds as recommended in the Z-Modem specifications. The
  558. optimum value depends on the link quality. On good links, 1024 (maximum)
  559. should be used.
  560.  
  561. * Window limit (bytes): can be set to a value between 0 and 32768. If set
  562. to 0 now transmit window is used. Otherwise the sender makes sure to never
  563. have more than this number of non-acknowledged bytes.
  564.  
  565. * ZCRQ spacing (bytes): can be set to a value between 0 and 32768. If set
  566. to 0 the sender will not send ZCRQ frames. Otherwise it will send a ZCRQ
  567. frame after having send this number of bytes. ZCRQ frames are used to see
  568. how far the receiver has got, but will otherwise not interrupt the data
  569. stream.
  570.  
  571. You should consult the Z-Modem specifications to get more details about
  572. these parameters. The default values should be fine for most cases.
  573.  
  574.  
  575. ___________________________________________________________________________
  576. THE "MACROS" MENU
  577.  
  578.  
  579. A macro is a text string kept in memory. There are 10 macro string buffers
  580. available. There is a different menu item for each possible buffer. The
  581. menu item name is the macro name, not it's content. The only limit for the
  582. length of a macro string length is available memory. The command key
  583. equivalents are 0 to 9. When the menu item is selected, or when the
  584. corresponding command key is pressed, the macro string is send out through
  585. the serial port using the parameters that are normally used for sending
  586. text files (prompt string, line and character delays, handshake option). So
  587. macro strings behave like text files, but are kept in memory and can be
  588. send easily with single keystrokes. If you press the option or the shift
  589. key while selecting a macro, the macro string is not send out but simply
  590. displayed in the terminal window. This can be used to test macro sets.
  591.  
  592. The first menu item is used to load a new macros file using a standard get
  593. file dialog. A macros file is a simple TEXT file with a ".m" suffix, that
  594. contains a complete set of macros, up to 10 different macros. This text
  595. file can be created and edited with any TEXT editor. If there exists a file
  596. named "Macros.m" in the script folder it will be used automatically when
  597. the Terminal program is started. The contents of the macros file must
  598. respect the following rules:
  599.  
  600. * Macro names start with the two characters "\m" (or "\M") and continue
  601. until the end of the line. They will get truncated to 30 characters in the
  602. "Macros" menu.
  603.  
  604. * All the text following a macro name becomes the macro text, including any
  605. line returns, they are translated to carriage return characters. The macro
  606. text stops one character before (the last character, usually the final line
  607. return, is not included) the beginning of a new macro name, or at the end
  608. of the file. The only limit for the length of macro text is available
  609. memory.
  610.  
  611. * To include the backlash character in macro text use the two character
  612. sequence "\\". To include control characters, other than the carriage
  613. return which is the same as control-M, use the two character sequence "\x",
  614. where "x" is the control character to use. E.g. to include control-C use
  615. "\C" (or "\c").
  616.  
  617. * Macros found in the macros file will get numbered automatically starting
  618. at 0. Macro numbers not used will get disabled in the menu.
  619.  
  620. See the included examples of some macro files to see how they might look
  621. like.
  622.  
  623. Note: the macro files to be loaded by the script function "macrol" must be
  624. in the "Terminal folder".
  625.  
  626.  
  627. ___________________________________________________________________________
  628. THE "SCRIPTS" MENU
  629.  
  630.  
  631. A script is a TEXT file containing a program written in "Terminal" script
  632. language, which is a subset of the C language. Scripts are interpreted by
  633. "Terminal", there is no compilation step involved. The easiest way to
  634. maintain scripts is to use a desk accessory TEXT editor. If you use a word
  635. processor, you must save the script files as pure TEXT, not in the native
  636. format of the word processor.
  637.  
  638. The first item in this menu can be used to select any script file on your
  639. disk using a standard file dialog box. Only TEXT files with a suffix of
  640. ".s" are considered to be scripts.
  641.  
  642. The other items depend on what "Terminal" found in it's folder when it was
  643. started. If a folder "Terminal Folder" exists in the application folder,
  644. all script files found there are included in the menu. If no such folder
  645. exists all script files found in the application folder are listed in the
  646. menu. Selecting a script in the menu will start it. The menu item name
  647. changes to outlined and expanded. To cancel a running script simply select
  648. it's menu item again. If a script is running the terminal window's name is
  649. set to the name of the executing script.
  650.  
  651. Only one script at a time can be executing. Any script can be selected to
  652. execute automatically when "Terminal" is started by using the "Terminal
  653. Options" menu. You can also double-click script files from the Finder, if
  654. they have been "kissed" before (see FILE menu commands). They are
  655. automatically opened and executed by "Terminal".
  656.  
  657.  
  658. ___________________________________________________________________________
  659. THE SCRIPT LANGUAGE
  660.  
  661.  
  662. The script language interpreted by "Terminal" is a subset of C with many
  663. specialized intrinsic (built-in) functions. Please read a C reference book
  664. to learn the C syntax, or see the enclosed script examples to get a feeling
  665. of the language. I will not write a book about programming in C here, only
  666. tell you the essentials.
  667.  
  668.  
  669. PROGRAM
  670.  
  671. A program is recognized as a script if it is in a TEXT file, and if the
  672. file name ends in ".s". Spaces, tabs and carriage return characters are
  673. considered to be white space. No identifier and no keyword can be separated
  674. by white space. A program consists of: comments, global variable
  675. definitions and function definitions. Everything included between "/*" and
  676. "*/" is considered a comment and will not be interpreted. Comments cannot
  677. be nested. The "/*" and "*/" are not recognized as comment delimiters
  678. inside string or character constants. Global variables are those variables
  679. that are known to all functions, unless their names are reused as local
  680. variables. Global variables can be initialized using any expression that
  681. involves either constants or other globals that are already defined at that
  682. point. Function definitions can appear in any order and their must be at
  683. least one function called "main" with no parameters. It is this function
  684. that is called when the script is started. Every function is supposed to
  685. return an integer value as result. If there is no return statement in a
  686. function, 0 will be returned. Functions can be called recursively. There
  687. are many built-in functions that are already defined when the script is
  688. started.
  689.  
  690. The value the "main" function returns is used as follows:
  691.       0 : Don't restore saved settings, continue application
  692.       1 : Restore saved settings, continue application
  693.     256 : Don't restore saved settings, quit application
  694.     257 : Restore saved settings, quit application
  695. Restore saved settings means that all changes the script made to settings
  696. are forgotten as soon as the script finishes. Quit application means, that
  697. as soon as the script has finished, "Terminal" quits. Usually this means
  698. returning to the Finder. But if "Terminal" was launched from HyperCard it
  699. will return to HyperCard.
  700.  
  701. This is an example of a simple script that displays the message "The number
  702. is 123" in the terminal window:
  703.  
  704.     int Number = 123;   /* This is a global variable */
  705.  
  706.     main ()     /* Every script must have a main() function */
  707.     {
  708.         /* display() is a built-in function */
  709.         display("The number is %i\r", Number);
  710.     }
  711.  
  712.  
  713. IDENTIFIERS
  714.  
  715. An identifier is a sequence of letters and digits; the first character must
  716. be a letter. The underscore "_" counts as a letter. An identifier can be of
  717. any length up to 255 characters. All characters are significant and are
  718. case sensitive. There are three types of identifiers: keywords, function
  719. names, variable names. The keywords are: "break", "char", "else", "for",
  720. "if", "int", "return", "while".
  721.  
  722.  
  723. CONSTANTS
  724.  
  725. An integer constant is a sequence of decimal digits, or 0x followed by up
  726. to 8 hexadecimal digits. An integer value is represented internally by 4
  727. bytes (32 bits). A minus sign before a constant is considered as an unary
  728. operator, not a part of the constant itself. A character constant is a
  729. sequence of 1 to 4 characters enclosed in single quotes. Character
  730. constants are converted to integer values, the byte values corresponding to
  731. the ASCII codes of the characters. A string constant is a sequence of
  732. characters enclosed in double quotes. String constants are automatically
  733. terminated by a NULL character. The value